package com.lx.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 段誉
 * @create 2019-06-19 13:23
 */
@RestController
@RequestMapping("demo2")
public class Demo2Controller {
  @GetMapping("set_session")
  public String setSession(HttpServletRequest request) {
    request.getSession().setAttribute("projectName", "demo2");
    return "demo2 install session success";
  }

  @GetMapping("get_session")
  public String getSession(HttpServletRequest request) {
    String projectName = (String) request.getSession().getAttribute("projectName");
    return "demo2 get projectName is " + projectName;
  }
}
